
package cn.bluethink.eguan.model.core;


import org.hibernate.validator.constraints.NotEmpty;

import com.fasterxml.jackson.annotation.JsonInclude;

/**
 * @title 根对象
 * @Copyright 苏州中科蓝迪公司所有(c)2016-2021
 * @version 0.1
 *
 * @note 修订历史： （1）liuxn于2018年8月14日构建初始版本0.1
 */
public class EgObject {

	/**
	 * 对象的唯一标识，建议“驿馆+”数据库中做到唯一
	 */
	@NotEmpty(message="id不能为空")
	private Long id = new Long(0);
	
	/**
	 * 对象名
	 */
	@NotEmpty (message="名字不能为空")
	@JsonInclude(JsonInclude.Include.NON_NULL)
	private String name;
	
	/**
	 * 对象类型
	 */
	@JsonInclude(JsonInclude.Include.NON_NULL)
	private EgOType type;

	/**
	 * 当前对象所处的审核状态
	 */
	private Integer checkStatus = EgCheckStatus.STATUS_PENDING;

	/**
	 * @since 1.0.0
	 * @roseuid 5B67AC4F0190
	 */
	public EgObject() {
	}
	
	public EgObject(Long id, String name, EgOType type) {
        this.id = id;
        this.name = name;
        this.type = type;
    }
	
	@Override
	public boolean equals(Object obj) {
		return !(obj instanceof EgObject) || this.id == null ? false : this.id.equals(((EgObject)obj).id);
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public EgOType getType() {
		return type;
	}

	public void setType(EgOType type) {
		this.type = type;
	}

	public Integer getCheckStatus() {
		return checkStatus;
	}

	public void setCheckStatus(Integer checkStatus) {
		this.checkStatus = checkStatus;
	}

	/**
	 * 判断对象ID是否有效
	 * @return
	 */
	public boolean isValidate() {
		return this.id > 0 ? true : false;
	}
}
